﻿/* Copyright 2007 dnAnalytics Project.
 *
 * Contributors to this file:
 * Jurgen Van Gael
 * Marcus Cuda - http://marcus.cuda.net
 *
 * This file is part of dnAnalytics.  dnAnalytics is licensed under the 
 * Microsoft Public License. See License.txt for a complete copy of the
 * license.
 */

namespace dnAnalytics.Math
{
    public static partial class SpecialFunctions
    {
        /// <summary>Calculates the error function evaluated at X.</summary>
        /// <returns>The error function evaluated at given value.</returns>
        /// <remarks>
        /// 	<list type="bullet">
        /// 		<item>returns 1 if <c>x == Double.PositiveInfinity</c>.</item>
        /// 		<item>returns -1 if <c>x == Double.NegativeInfinity</c>.</item>
        /// 	</list>
        /// </remarks>
        /// <param name="x">The value to evaluate.</param>
        public static double Erf(double x)
        {
            return SafeNativeMethods.native_erf(x);
        }

        /// <summary>Calculates the complementaryerror function evaluated at X.</summary>
        /// <returns>The complementary error function evaluated at given value.</returns>
        /// <remarks>
        /// 	<list type="bullet">
        /// 		<item>returns 0 if <c>x == Double.PositiveInfinity</c>.</item>
        /// 		<item>returns 2 if <c>x == Double.NegativeInfinity</c>.</item>
        /// 	</list>
        /// </remarks>
        /// <param name="x">The value to evaluate.</param>
        public static double Erfc(double x)
        {
            return SafeNativeMethods.native_erfc(x);
        }

        ///<summary>Calculates the inverse error function evaluated at X.</summary>
        /// <returns>The inverse error function evaluated at given value.</returns>
        /// <remarks>
        /// 	<list type="bullet">
        /// 		<item>returns Double.PositiveInfinity if <c>x &gt;= 1.0</c>.</item>
        /// 		<item>returns Double.NegativeInfinity if <c>x &lt;= -1.0</c>.</item>
        /// 	</list>
        /// </remarks>
        ///<summary>Calculates the inverse error function evaluated at X.</summary>
        ///<param name="x">value to evaluate.</param>
        ///<returns>the error function evaluated at X.</returns>
        public static double ErfInv(double x)
        {
            return SafeNativeMethods.native_erfinv(x);
        }
    }
}
